
import os
import time
env = Environment()
env["PROGSUFFIX"] = ".out"            # 可执行文件后缀.out
env["CCFLAGS"] = " -g3 -O0 -Wall"     # gdb 调试

def build_share_lib():
    SharedLibrary("easylogging","easylogging++.cc")
    # Install(target="/usr/lib",source=['easylogging.so'])  # --NG
    # Command("/usr/lib/libeasylogging.so","libeasylogging.so","sudo cp -rf libeasylogging.so /usr/lib/")    # --NG
    # Command("./lib/libeasylogging.so","libeasylogging.so","cp -rf libeasylogging.so ./lib/libeasylogging.so")  # --OK
    if not os.path.exists("/usr/lib/libeasylogging.so"):
        os.system("sudo cp -rf libeasylogging.so /usr/lib/libeasylogging.so") # --ok
        print("copy libeasylogging.so /usr/lib ---ok")
        # os.system("sudo install libeasylogging.so /usr/lib") # --ok

## 模板2
build_share_lib()
env["LIBS"] = ["easylogging"]
env.Program("1_easylogging_日志.cc", LIBS=["easylogging"],LIBPATH='.')
env.Program("2_easylogging_读取配置.cc")
env.Program("3_easylogging_条件打印.cc")
